package ru.papergames.view.mediators
{
	import by.andronix.logger.Logger;
	import mx.logging.ILogger;
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.IProxy;
	import org.puremvc.as3.patterns.mediator.Mediator;
	import ru.papergames.model.proxies.LoginProxy;
	import ru.papergames.model.proxies.MessagingSocketProxy;
	import ru.papergames.model.proxies.MsgServerAccessProxy;
	import ru.papergames.model.proxies.PersistentProxy;
	import ru.papergames.model.proxies.SessionDataProxy;
	import ru.papergames.model.proxies.SettingsProxy;
	
	
	
	

	public class BaseMediator extends Mediator implements IMediator
	{
		public function BaseMediator(mediatorName:String=null, viewComponent:Object=null)
		{
			super(mediatorName, viewComponent);
		}
		
		protected function getMediator(mediatorName:String):IMediator {
			return facade.retrieveMediator(mediatorName);
		}	
		
		protected function getProxy(proxyName:String):IProxy {
			return facade.retrieveProxy(proxyName);
		}
		
		protected function get settingsProxy():SettingsProxy {
			return this.getProxy(SettingsProxy.NAME) as SettingsProxy;
		}
		
		protected function get persistentProxy():PersistentProxy {
			return this.getProxy(PersistentProxy.NAME) as PersistentProxy;
		}
		
		protected function get loginProxy():LoginProxy {
			return this.getProxy(LoginProxy.NAME) as LoginProxy;
		}					
		
		protected function get messagingProxy():MessagingSocketProxy {
			return this.getProxy(MessagingSocketProxy.NAME) as MessagingSocketProxy;
		}
		
		protected function get msgSrvAccessProxy():MsgServerAccessProxy {
			return this.getProxy(MsgServerAccessProxy.NAME) as MsgServerAccessProxy;
		}
		
		protected function get sessProxy():SessionDataProxy {
			return this.getProxy(SessionDataProxy.NAME) as SessionDataProxy;
		}
		
		protected function get logger():ILogger {
			return Logger.getLogger(this);
		}
		
		override public function onRegister():void {
			super.onRegister();
			logger.debug('onRegister()');
		}
		
		override public function onRemove():void {
			super.onRemove();
			logger.debug('onRemove()');
		}
		
	}
}